<template>
  <div id="app">
    <header class="site-header jumbotron">
      <div class="container">
        <div class="row">
          <div class="col-xs-12">
            <h1>请发表对Vue2.0的评论</h1>
          </div>
        </div>
      </div>
    </header>
    <div class="container">
        <AddContext :icreComment="icreComment" />
        <CommentList :comments="comments" :delComment="delComment"/>
    </div>
  </div>
</template>

<script>
import AddContext from './components/AddContext'
import CommentList from './components/CommentList'

export default {
  name: 'App',
  methods: {
    icreComment(comment){
      this.comments.unshift(comment)
    },
    delComment(index){
      this.comments.splice(index,1)
    }
  },
  components: {
    AddContext,CommentList
  },
  data () {
    return {
      comments: [
        {name: '孙信宇', content:'React需要多个集成和支持工具才能运行'},
        {name: '尤雨溪', content:'未来App的趋势是轻量化和细化，能解决问题的应用1111'}
      ]
    }
  }
}
</script>
